package com.simit.mapper;

import com.simit.pojo.YuanShen;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("yuanShenMapper")
public interface YuanShenMapper {

    @Select("select * from yuan_shen order by name")
    @ResultMap("yuanShenResultMap")
    List<YuanShen> selectAll();

    @Select("select * from yuan_shen where name = #{name}")
    @ResultMap("yuanShenResultMap")
    YuanShen selectByName(String name);

    List<YuanShen> selectByConditions(YuanShen yuanShen);

    @Insert("insert into yuan_shen values (null, #{name}, #{starLevel}, #{element}, #{weapon})")
    void add(YuanShen yuanShen);

    @Update("update yuan_shen set star_level = #{starLevel}, element = #{element}, weapon = #{weapon} where name = #{name}")
    void update(YuanShen yuanShen);

    @Delete("delete from yuan_shen where name = #{name}")
    void delete(YuanShen yuanShen);

    void deleteByNames(@Param("names") String[] names);
}